﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.GERP.GFMS.MODEL;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.IDAL;
using KPIS.GERP.GFMS.DALFactory;

// test only
using KPIS.GERP.GFMS.DAL;

namespace KPIS.GERP.GFMS.BLL
{
    public class B_ICM_Bid : IBLL_ICM_Bid
    {
        Common common = new Common();
        private static readonly IDAL_ICM_Bid dal = DataAccess.Create_ICM_Bid();

        public B_ICM_Bid()
        {

        }

        public IList<M_ICM_Bid> GetFull(string bgm_year, string receive_type)
        {
            Nullable<int> nbgm_year = common.ConvertNullInt(bgm_year);
            return dal.GetFull(nbgm_year, receive_type);
        }

        public IList<M_ICM_Bid> GetList(string bgm_year, string receive_type, string filter)
        {
            Nullable<int> nbgm_year = common.ConvertNullInt(bgm_year);
            return dal.GetList(nbgm_year, receive_type, filter);
        }

        public IList<M_ICM_Bid> GetReceiveList(string bgm_year, string receive_date, string filter)
        {
            Nullable<int> nbgm_year = common.ConvertNullInt(bgm_year);
            Nullable<DateTime> nreceive_date = common.ConvertNullDateTime(receive_date);
            return dal.GetReceiveList(nbgm_year, nreceive_date, filter);
        }

        public IList<M_ICM_Bid> GetOfferList(string bgm_year, string offer_date, string filter)
        {
            Nullable<int> nbgm_year = common.ConvertNullInt(bgm_year);
            Nullable<DateTime> noffer_date = common.ConvertNullDateTime(offer_date);
            return dal.GetOfferList(nbgm_year, noffer_date, filter);
        }

        public M_ICM_Bid GetInfo(string seq)
        {
            int nSeq;
 
            if (seq == null)
                return null;

            if (common.IsNumeric(seq))
            {
                nSeq = int.Parse(seq);
                return dal.GetInfo(nSeq);
            }
            else
            {
                return null;
            }
        }
    }
}
